﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ActivityInfo.ArcGIS.Tiles
{
    public partial class ProgressDialog : Form, IProgressTracker
    {
        private bool cancelled;

        public ProgressDialog()
        {
            InitializeComponent();
        }

        private void ProgressDialog_Load(object sender, EventArgs e)
        {

        }

        public void start(int totalTiles)
        {
            cancelled = false;
            progressBar.Minimum = 0;
            progressBar.Value = 0;
            progressBar.Maximum = totalTiles;
        }

        public void tileCompleted()
        {
            progressBar.Value++;
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            cancelled = true;

            this.Close();
        }

        public bool isCancelled()
        {
            return cancelled;
        }
    }
}
